#!/bin/bash

# 检查samba是否已安装
if rpm -q samba >/dev/null 2>&1; then
    echo "[-] 检测失败: samba已安装"
    
    # 显示已安装的samba相关包
    echo "    已安装的samba相关包:"
    rpm -qa | grep samba | sed 's/^/    /'
    
    # 检查服务状态
    if systemctl is-active smb >/dev/null 2>&1; then
        echo "    smb服务正在运行"
    fi
    if systemctl is-active nmb >/dev/null 2>&1; then
        echo "    nmb服务正在运行"
    fi
    
    exit 1
else
    echo "[+] 检测通过: samba未安装"
    exit 0
fi

